<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- | Basic operations on graphs.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Data.Graph.Ops</span><span>
</span><span id="line-7"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addNode"><span class="hs-identifier">addNode</span></a></span><span>
</span><span id="line-8"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#delNode"><span class="hs-identifier">delNode</span></a></span><span>
</span><span id="line-9"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#getNode"><span class="hs-identifier">getNode</span></a></span><span>
</span><span id="line-10"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier">lookupNode</span></a></span><span>
</span><span id="line-11"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#modNode"><span class="hs-identifier">modNode</span></a></span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-14"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addConflict"><span class="hs-identifier">addConflict</span></a></span><span>
</span><span id="line-17"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#delConflict"><span class="hs-identifier">delConflict</span></a></span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addConflicts"><span class="hs-identifier">addConflicts</span></a></span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addCoalesce"><span class="hs-identifier">addCoalesce</span></a></span><span>
</span><span id="line-21"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#delCoalesce"><span class="hs-identifier">delCoalesce</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addExclusion"><span class="hs-identifier">addExclusion</span></a></span><span>
</span><span id="line-24"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addExclusions"><span class="hs-identifier">addExclusions</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#addPreference"><span class="hs-identifier">addPreference</span></a></span><span>
</span><span id="line-27"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceNodes"><span class="hs-identifier">coalesceNodes</span></a></span><span>
</span><span id="line-28"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceGraph"><span class="hs-identifier">coalesceGraph</span></a></span><span>
</span><span id="line-29"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeNode"><span class="hs-identifier">freezeNode</span></a></span><span>
</span><span id="line-30"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeOneInGraph"><span class="hs-identifier">freezeOneInGraph</span></a></span><span>
</span><span id="line-31"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeAllInGraph"><span class="hs-identifier">freezeAllInGraph</span></a></span><span>
</span><span id="line-32"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#scanGraph"><span class="hs-identifier">scanGraph</span></a></span><span>
</span><span id="line-33"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#setColor"><span class="hs-identifier">setColor</span></a></span><span>
</span><span id="line-34"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#validateGraph"><span class="hs-identifier">validateGraph</span></a></span><span>
</span><span id="line-35"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#slurpNodeConflictCount"><span class="hs-identifier">slurpNodeConflictCount</span></a></span><span>
</span><span id="line-36"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">where</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html"><span class="hs-identifier">GHC.Data.Graph.Base</span></a></span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>        </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#union"><span class="hs-identifier">union</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-comment">-- | Lookup a node from the graph.</span><span>
</span><span id="line-52"></span><span id="local-6989586621680943532"><span id="local-6989586621680943533"><span id="local-6989586621680943535"><span class="annot"><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-type">lookupNode</span></a></span><span>
</span><span id="line-53"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943535"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-54"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943535"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943533"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943532"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-55"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943535"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621680943535"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943533"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943532"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span id="lookupNode"><span class="annot"><span class="annottext">lookupNode :: forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var hs-var">lookupNode</span></a></span></span><span> </span><span id="local-6989586621680943203"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943203"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680943202"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943202"><span class="hs-identifier hs-var">k</span></a></span></span><span>
</span><span id="line-58"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; k -&gt; Maybe (Node k cls color)
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943203"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943202"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span class="hs-comment">-- | Get a node from the graph, throwing an error if it's not there</span><span>
</span><span id="line-62"></span><span id="local-6989586621680943518"><span id="local-6989586621680943519"><span id="local-6989586621680943520"><span class="annot"><a href="GHC.Data.Graph.Ops.html#getNode"><span class="hs-identifier hs-type">getNode</span></a></span><span>
</span><span id="line-63"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943520"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-64"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943520"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943519"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943518"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-65"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943520"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943520"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943519"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943518"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-66"></span><span>
</span><span id="line-67"></span><span id="getNode"><span class="annot"><span class="annottext">getNode :: forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Ops.html#getNode"><span class="hs-identifier hs-var hs-var">getNode</span></a></span></span><span> </span><span id="local-6989586621680943197"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943197"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680943196"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943196"><span class="hs-identifier hs-var">k</span></a></span></span><span>
</span><span id="line-68"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; k -&gt; Maybe (Node k cls color)
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943197"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943196"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-69"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680943195"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943195"><span class="hs-identifier hs-var">node</span></a></span></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943195"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-70"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Node k cls color)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Node k cls color
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;ColorOps.getNode: not found&quot;</span></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span class="hs-comment">-- | Add a node to the graph, linking up its edges</span><span>
</span><span id="line-74"></span><span id="local-6989586621680943511"><span id="local-6989586621680943512"><span id="local-6989586621680943513"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addNode"><span class="hs-identifier hs-type">addNode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943513"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-75"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943513"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943513"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943512"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943511"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-76"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943513"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943512"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943511"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943513"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943512"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943511"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span id="addNode"><span class="annot"><span class="annottext">addNode :: forall k cls color.
Uniquable k =&gt;
k -&gt; Node k cls color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addNode"><span class="hs-identifier hs-var hs-var">addNode</span></a></span></span><span> </span><span id="local-6989586621680943191"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943191"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680943190"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943190"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span id="local-6989586621680943189"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943189"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-79"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-80"></span><span>        </span><span class="hs-comment">-- add back conflict edges from other nodes to this one</span><span>
</span><span id="line-81"></span><span>        </span><span id="local-6989586621680943186"><span class="annot"><span class="annottext">map_conflict :: UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943186"><span class="hs-identifier hs-var hs-var">map_conflict</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-82"></span><span>          </span><span class="annot"><span class="annottext">(k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
forall elt a. (elt -&gt; a -&gt; a) -&gt; a -&gt; UniqSet elt -&gt; a
</span><a href="GHC.Types.Unique.Set.html#nonDetStrictFoldUniqSet"><span class="hs-identifier hs-var">nonDetStrictFoldUniqSet</span></a></span><span>
</span><span id="line-83"></span><span>            </span><span class="hs-comment">-- It's OK to use a non-deterministic fold here because the</span><span>
</span><span id="line-84"></span><span>            </span><span class="hs-comment">-- operation is commutative</span><span>
</span><span id="line-85"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-var">adjustUFM_C</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943183"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943183"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943183"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-86"></span><span>                                      </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943183"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943191"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943189"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943190"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span>        </span><span class="hs-comment">-- add back coalesce edges from other nodes to this one</span><span>
</span><span id="line-91"></span><span>        </span><span id="local-6989586621680943178"><span class="annot"><span class="annottext">map_coalesce :: UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943178"><span class="hs-identifier hs-var hs-var">map_coalesce</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-92"></span><span>          </span><span class="annot"><span class="annottext">(k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
forall elt a. (elt -&gt; a -&gt; a) -&gt; a -&gt; UniqSet elt -&gt; a
</span><a href="GHC.Types.Unique.Set.html#nonDetStrictFoldUniqSet"><span class="hs-identifier hs-var">nonDetStrictFoldUniqSet</span></a></span><span>
</span><span id="line-93"></span><span>            </span><span class="hs-comment">-- It's OK to use a non-deterministic fold here because the</span><span>
</span><span id="line-94"></span><span>            </span><span class="hs-comment">-- operation is commutative</span><span>
</span><span id="line-95"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-var">adjustUFM_C</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943177"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943177"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943177"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-96"></span><span>                                      </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943177"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943191"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-97"></span><span>            </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943186"><span class="hs-identifier hs-var">map_conflict</span></a></span><span>
</span><span id="line-98"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943190"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span>  </span><span class="hs-keyword">in</span><span>    </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943189"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">graphMap :: UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var">graphMap</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
-&gt; k -&gt; Node k cls color -&gt; UniqFM k (Node k cls color)
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943178"><span class="hs-identifier hs-var">map_coalesce</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943191"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943190"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-comment">-- | Delete a node and all its edges from the graph.</span><span>
</span><span id="line-105"></span><span id="local-6989586621680943494"><span id="local-6989586621680943495"><span id="local-6989586621680943496"><span class="annot"><a href="GHC.Data.Graph.Ops.html#delNode"><span class="hs-identifier hs-type">delNode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943496"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943496"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943496"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943495"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943494"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943496"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943495"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943494"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span id="delNode"><span class="annot"><span class="annottext">delNode :: forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delNode"><span class="hs-identifier hs-var hs-var">delNode</span></a></span></span><span> </span><span id="local-6989586621680943172"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943172"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680943171"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943171"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-109"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680943170"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943170"><span class="hs-identifier hs-var">node</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943171"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943172"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-110"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>   </span><span class="hs-comment">-- delete conflict edges from other nodes to this one.</span><span>
</span><span id="line-111"></span><span>                </span><span id="local-6989586621680943167"><span class="annot"><span class="annottext">graph1 :: Graph k cls color
</span><a href="#local-6989586621680943167"><span class="hs-identifier hs-var hs-var">graph1</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Graph k cls color -&gt; k -&gt; Graph k cls color)
-&gt; Graph k cls color -&gt; [k] -&gt; Graph k cls color
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943165"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943165"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621680943164"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943164"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680943162"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943162"><span class="hs-identifier hs-var">g'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delConflict"><span class="hs-identifier hs-var">delConflict</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943164"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943172"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943165"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943162"><span class="hs-identifier hs-var">g'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943171"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-112"></span><span>                        </span><span class="annot"><span class="annottext">([k] -&gt; Graph k cls color) -&gt; [k] -&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943170"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>                </span><span class="hs-comment">-- delete coalesce edge from other nodes to this one.</span><span>
</span><span id="line-115"></span><span>                </span><span id="local-6989586621680943159"><span class="annot"><span class="annottext">graph2 :: Graph k cls color
</span><a href="#local-6989586621680943159"><span class="hs-identifier hs-var hs-var">graph2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Graph k cls color -&gt; k -&gt; Graph k cls color)
-&gt; Graph k cls color -&gt; [k] -&gt; Graph k cls color
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943158"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943158"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621680943157"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943157"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680943155"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943155"><span class="hs-identifier hs-var">g'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delCoalesce"><span class="hs-identifier hs-var">delCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943157"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943172"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943158"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943155"><span class="hs-identifier hs-var">g'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943167"><span class="hs-identifier hs-var">graph1</span></a></span><span>
</span><span id="line-116"></span><span>                        </span><span class="annot"><span class="annottext">([k] -&gt; Graph k cls color) -&gt; [k] -&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943170"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-117"></span><span>                        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span>                </span><span class="hs-comment">-- delete the node</span><span>
</span><span id="line-120"></span><span>                </span><span id="local-6989586621680943153"><span class="annot"><span class="annottext">graph3 :: Graph k cls color
</span><a href="#local-6989586621680943153"><span class="hs-identifier hs-var hs-var">graph3</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943151"><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943151"><span class="hs-identifier hs-var">fm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; k -&gt; UniqFM k (Node k cls color)
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#delFromUFM"><span class="hs-identifier hs-var">delFromUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943151"><span class="hs-identifier hs-var">fm</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943172"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943159"><span class="hs-identifier hs-var">graph2</span></a></span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span>          </span><span class="hs-keyword">in</span><span>    </span><span class="annot"><span class="annottext">Graph k cls color -&gt; Maybe (Graph k cls color)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943153"><span class="hs-identifier hs-var">graph3</span></a></span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-125"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Graph k cls color)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="hs-comment">-- | Modify a node in the graph.</span><span>
</span><span id="line-129"></span><span class="hs-comment">--      returns Nothing if the node isn't present.</span><span>
</span><span id="line-130"></span><span class="hs-comment">--</span><span>
</span><span id="line-131"></span><span id="local-6989586621680943472"><span id="local-6989586621680943473"><span id="local-6989586621680943474"><span class="annot"><a href="GHC.Data.Graph.Ops.html#modNode"><span class="hs-identifier hs-type">modNode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-132"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943473"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943472"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943473"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943472"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943473"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943472"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943474"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943473"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943472"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span id="modNode"><span class="annot"><span class="annottext">modNode :: forall k cls color.
Uniquable k =&gt;
(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#modNode"><span class="hs-identifier hs-var hs-var">modNode</span></a></span></span><span> </span><span id="local-6989586621680943146"><span class="annot"><span class="annottext">Node k cls color -&gt; Node k cls color
</span><a href="#local-6989586621680943146"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680943145"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943145"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680943144"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943144"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-136"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943144"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943145"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-137"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>
</span><span id="line-138"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; Maybe (Graph k cls color)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span>
</span><span id="line-139"></span><span>         </span><span class="annot"><span class="annottext">(Graph k cls color -&gt; Maybe (Graph k cls color))
-&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-140"></span><span>                 </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943142"><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943142"><span class="hs-identifier hs-var">fm</span></a></span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span>  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680943140"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943140"><span class="hs-identifier hs-var">node</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; k -&gt; Maybe (Node k cls color)
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943142"><span class="hs-identifier hs-var">fm</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943145"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-141"></span><span>                                </span><span id="local-6989586621680943139"><span class="annot"><span class="annottext">node' :: Node k cls color
</span><a href="#local-6989586621680943139"><span class="hs-identifier hs-var hs-var">node'</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Node k cls color
</span><a href="#local-6989586621680943146"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943140"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-142"></span><span>                           </span><span class="hs-keyword">in</span><span>   </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
-&gt; k -&gt; Node k cls color -&gt; UniqFM k (Node k cls color)
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943142"><span class="hs-identifier hs-var">fm</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943145"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943139"><span class="hs-identifier hs-var">node'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-143"></span><span>                </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943144"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span>        </span><span class="annot"><span class="annottext">Maybe (Node k cls color)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Graph k cls color)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="hs-comment">-- | Get the size of the graph, O(n)</span><span>
</span><span id="line-149"></span><span id="local-6989586621680943466"><span id="local-6989586621680943467"><span id="local-6989586621680943468"><span class="annot"><a href="GHC.Data.Graph.Ops.html#size"><span class="hs-identifier hs-type">size</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943468"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943467"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943466"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span></span></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span id="size"><span class="annot"><span class="annottext">size :: forall k cls color. Graph k cls color -&gt; Int
</span><a href="GHC.Data.Graph.Ops.html#size"><span class="hs-identifier hs-var hs-var">size</span></a></span></span><span> </span><span id="local-6989586621680943138"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943138"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-152"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; Int
forall key elt. UniqFM key elt -&gt; Int
</span><a href="GHC.Types.Unique.FM.html#sizeUFM"><span class="hs-identifier hs-var">sizeUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; Int)
-&gt; UniqFM k (Node k cls color) -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943138"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span class="hs-comment">-- | Union two graphs together.</span><span>
</span><span id="line-156"></span><span id="local-6989586621680943458"><span id="local-6989586621680943459"><span id="local-6989586621680943460"><span class="annot"><a href="GHC.Data.Graph.Ops.html#union"><span class="hs-identifier hs-type">union</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943460"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943459"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943458"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943460"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943459"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943458"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943460"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943459"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943458"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span id="union"><span class="annot"><span class="annottext">union :: forall k cls color.
Graph k cls color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#union"><span class="hs-identifier hs-var hs-var">union</span></a></span></span><span>   </span><span id="local-6989586621680943136"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943136"><span class="hs-identifier hs-var">graph1</span></a></span></span><span> </span><span id="local-6989586621680943135"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943135"><span class="hs-identifier hs-var">graph2</span></a></span></span><span>
</span><span id="line-159"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph :: forall k cls color.
UniqFM k (Node k cls color) -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">graphMap :: UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var">graphMap</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color)
forall key elt. UniqFM key elt -&gt; UniqFM key elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#plusUFM"><span class="hs-identifier hs-var">plusUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943136"><span class="hs-identifier hs-var">graph1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943135"><span class="hs-identifier hs-var">graph2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="hs-comment">-- | Add a conflict between nodes to the graph, creating the nodes required.</span><span>
</span><span id="line-164"></span><span class="hs-comment">--      Conflicts are virtual regs which need to be colored differently.</span><span>
</span><span id="line-165"></span><span id="local-6989586621680943447"><span id="local-6989586621680943448"><span id="local-6989586621680943449"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addConflict"><span class="hs-identifier hs-type">addConflict</span></a></span><span>
</span><span id="line-166"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943449"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-167"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943449"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943448"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943449"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943448"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943449"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943448"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943447"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943449"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943448"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943447"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span id="addConflict"><span class="annot"><span class="annottext">addConflict :: forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; (k, cls) -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addConflict"><span class="hs-identifier hs-var hs-var">addConflict</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943129"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943129"><span class="hs-identifier hs-var">u1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680943128"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943128"><span class="hs-identifier hs-var">c1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943127"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943127"><span class="hs-identifier hs-var">u2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680943126"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943126"><span class="hs-identifier hs-var">c2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621680943121"><span class="annot"><span class="annottext">addNeighbor :: k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943121"><span class="hs-identifier hs-var hs-var">addNeighbor</span></a></span></span><span> </span><span id="local-6989586621680943120"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943120"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680943119"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943119"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680943118"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943118"><span class="hs-identifier hs-var">u'</span></a></span></span><span>
</span><span id="line-172"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-173"></span><span>                        </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943116"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943116"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943116"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943116"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943118"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943120"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943119"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; UniqSet k
forall a. Uniquable a =&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unitUniqSet"><span class="hs-identifier hs-var">unitUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943118"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-175"></span><span>                        </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943120"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span>   </span><span class="hs-keyword">in</span><span>   </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-178"></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall {k} {cls} {color}.
Uniquable k =&gt;
k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943121"><span class="hs-identifier hs-var">addNeighbor</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943129"><span class="hs-identifier hs-var">u1</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943128"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943127"><span class="hs-identifier hs-var">u2</span></a></span><span>
</span><span id="line-179"></span><span>        </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall {k} {cls} {color}.
Uniquable k =&gt;
k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943121"><span class="hs-identifier hs-var">addNeighbor</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943127"><span class="hs-identifier hs-var">u2</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943126"><span class="hs-identifier hs-var">c2</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943129"><span class="hs-identifier hs-var">u1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span class="hs-comment">-- | Delete a conflict edge. k1 -&gt; k2</span><span>
</span><span id="line-183"></span><span class="hs-comment">--      returns Nothing if the node isn't in the graph</span><span>
</span><span id="line-184"></span><span id="local-6989586621680943485"><span id="local-6989586621680943486"><span id="local-6989586621680943487"><span class="annot"><a href="GHC.Data.Graph.Ops.html#delConflict"><span class="hs-identifier hs-type">delConflict</span></a></span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943487"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-186"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943487"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943487"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-187"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943487"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943486"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943485"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943487"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943486"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943485"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span id="delConflict"><span class="annot"><span class="annottext">delConflict :: forall k cls color.
Uniquable k =&gt;
k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delConflict"><span class="hs-identifier hs-var hs-var">delConflict</span></a></span></span><span> </span><span id="local-6989586621680943109"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943109"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621680943108"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943108"><span class="hs-identifier hs-var">k2</span></a></span></span><span>
</span><span id="line-190"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#modNode"><span class="hs-identifier hs-var">modNode</span></a></span><span>
</span><span id="line-191"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943107"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943107"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943107"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-identifier hs-var">delOneFromUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943107"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943108"><span class="hs-identifier hs-var">k2</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943109"><span class="hs-identifier hs-var">k1</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span class="hs-comment">-- | Add some conflicts to the graph, creating nodes if required.</span><span>
</span><span id="line-196"></span><span class="hs-comment">--      All the nodes in the set are taken to conflict with each other.</span><span>
</span><span id="line-197"></span><span id="local-6989586621680943426"><span id="local-6989586621680943427"><span id="local-6989586621680943428"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addConflicts"><span class="hs-identifier hs-type">addConflicts</span></a></span><span>
</span><span id="line-198"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943428"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-199"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943428"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943428"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943427"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943428"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943427"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943426"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943428"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943427"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943426"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span id="addConflicts"><span class="annot"><span class="annottext">addConflicts :: forall k cls color.
Uniquable k =&gt;
UniqSet k -&gt; (k -&gt; cls) -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addConflicts"><span class="hs-identifier hs-var hs-var">addConflicts</span></a></span></span><span> </span><span id="local-6989586621680943101"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943101"><span class="hs-identifier hs-var">conflicts</span></a></span></span><span> </span><span id="local-6989586621680943100"><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943100"><span class="hs-identifier hs-var">getClass</span></a></span></span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>        </span><span class="hs-comment">-- just a single node, but no conflicts, create the node anyway.</span><span>
</span><span id="line-205"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943099"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943099"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943101"><span class="hs-identifier hs-var">conflicts</span></a></span><span>
</span><span id="line-206"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-207"></span><span>        </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-208"></span><span>                </span><span class="annot"><span class="annottext">Node k cls color -&gt; Node k cls color
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-209"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943099"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943100"><span class="hs-identifier hs-var">getClass</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943099"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943099"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-213"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-214"></span><span>        </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680943097"><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943097"><span class="hs-identifier hs-var">fm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; k -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; [k]
-&gt; UniqFM k (Node k cls color)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943096"><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943096"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621680943095"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943095"><span class="hs-identifier hs-var">u</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k
-&gt; (k -&gt; cls)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k cls color.
Uniquable k =&gt;
k
-&gt; (k -&gt; cls)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#addConflictSet1"><span class="hs-identifier hs-var">addConflictSet1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943095"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943100"><span class="hs-identifier hs-var">getClass</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943101"><span class="hs-identifier hs-var">conflicts</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943096"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943097"><span class="hs-identifier hs-var">fm</span></a></span><span>
</span><span id="line-215"></span><span>                </span><span class="annot"><span class="annottext">([k] -&gt; UniqFM k (Node k cls color))
-&gt; [k] -&gt; UniqFM k (Node k cls color)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943101"><span class="hs-identifier hs-var">conflicts</span></a></span><span>
</span><span id="line-216"></span><span>                </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span id="local-6989586621680943419"><span id="local-6989586621680943420"><span id="local-6989586621680943421"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addConflictSet1"><span class="hs-identifier hs-type">addConflictSet1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-220"></span><span>                </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943420"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html#UniqSet"><span class="hs-identifier hs-type">UniqSet</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-221"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943420"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943419"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943421"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943420"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943419"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-223"></span><span id="addConflictSet1"><span class="annot"><span class="annottext">addConflictSet1 :: forall k cls color.
Uniquable k =&gt;
k
-&gt; (k -&gt; cls)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#addConflictSet1"><span class="hs-identifier hs-var hs-var">addConflictSet1</span></a></span></span><span> </span><span id="local-6989586621680943090"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943090"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680943089"><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943089"><span class="hs-identifier hs-var">getClass</span></a></span></span><span> </span><span id="local-6989586621680943088"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943088"><span class="hs-identifier hs-var">set</span></a></span></span><span>
</span><span id="line-224"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-identifier hs-var">delOneFromUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943088"><span class="hs-identifier hs-var">set</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943090"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-225"></span><span>    </span><span id="local-6989586621680943087"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943087"><span class="hs-identifier hs-var">set'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-226"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943086"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943086"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943086"><span class="hs-identifier hs-var">node</span></a></span><span>                  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; UniqSet k -&gt; UniqSet k
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionUniqSets"><span class="hs-identifier hs-var">unionUniqSets</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943087"><span class="hs-identifier hs-var">set'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943086"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943090"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943089"><span class="hs-identifier hs-var">getClass</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943090"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680943087"><span class="hs-identifier hs-var">set'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-228"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943090"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-comment">-- | Add an exclusion to the graph, creating nodes if required.</span><span>
</span><span id="line-232"></span><span class="hs-comment">--      These are extra colors that the node cannot use.</span><span>
</span><span id="line-233"></span><span id="local-6989586621680943412"><span id="local-6989586621680943413"><span id="local-6989586621680943414"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addExclusion"><span class="hs-identifier hs-type">addExclusion</span></a></span><span>
</span><span id="line-234"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943414"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943413"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943414"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943414"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943412"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943413"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-236"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943414"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943412"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943413"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943414"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943412"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943413"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span id="addExclusion"><span class="annot"><span class="annottext">addExclusion :: forall k color cls.
(Uniquable k, Uniquable color) =&gt;
k -&gt; (k -&gt; cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addExclusion"><span class="hs-identifier hs-var hs-var">addExclusion</span></a></span></span><span> </span><span id="local-6989586621680943079"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943079"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680943078"><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943078"><span class="hs-identifier hs-var">getClass</span></a></span></span><span> </span><span id="local-6989586621680943077"><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943077"><span class="hs-identifier hs-var">color</span></a></span></span><span>
</span><span id="line-239"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-240"></span><span>        </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-241"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943076"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943076"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943076"><span class="hs-identifier hs-var">node</span></a></span><span>                  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeExclusions :: UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var">nodeExclusions</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet color -&gt; color -&gt; UniqSet color
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet color
forall k cls color. Node k cls color -&gt; UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var hs-var">nodeExclusions</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943076"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943077"><span class="hs-identifier hs-var">color</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943079"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943078"><span class="hs-identifier hs-var">getClass</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943079"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeExclusions :: UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var">nodeExclusions</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">color -&gt; UniqSet color
forall a. Uniquable a =&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unitUniqSet"><span class="hs-identifier hs-var">unitUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943077"><span class="hs-identifier hs-var">color</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-243"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943079"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-244"></span><span>
</span><span id="line-245"></span><span id="local-6989586621680943403"><span id="local-6989586621680943404"><span id="local-6989586621680943405"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addExclusions"><span class="hs-identifier hs-type">addExclusions</span></a></span><span>
</span><span id="line-246"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943405"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943404"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943405"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943405"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943403"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680943404"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-248"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943405"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943403"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943404"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943405"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943403"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943404"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span id="addExclusions"><span class="annot"><span class="annottext">addExclusions :: forall k color cls.
(Uniquable k, Uniquable color) =&gt;
k
-&gt; (k -&gt; cls) -&gt; [color] -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addExclusions"><span class="hs-identifier hs-var hs-var">addExclusions</span></a></span></span><span> </span><span id="local-6989586621680943069"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943069"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680943068"><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943068"><span class="hs-identifier hs-var">getClass</span></a></span></span><span> </span><span id="local-6989586621680943067"><span class="annot"><span class="annottext">[color]
</span><a href="#local-6989586621680943067"><span class="hs-identifier hs-var">colors</span></a></span></span><span> </span><span id="local-6989586621680943066"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943066"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-251"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(color -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; Graph k cls color -&gt; [color] -&gt; Graph k cls color
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; (k -&gt; cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
forall k color cls.
(Uniquable k, Uniquable color) =&gt;
k -&gt; (k -&gt; cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addExclusion"><span class="hs-identifier hs-var">addExclusion</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943069"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; cls
</span><a href="#local-6989586621680943068"><span class="hs-identifier hs-var">getClass</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943066"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">[color]
</span><a href="#local-6989586621680943067"><span class="hs-identifier hs-var">colors</span></a></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span class="hs-comment">-- | Add a coalescence edge to the graph, creating nodes if required.</span><span>
</span><span id="line-255"></span><span class="hs-comment">--      It is considered adventageous to assign the same color to nodes in a coalesence.</span><span>
</span><span id="line-256"></span><span id="local-6989586621680943062"><span id="local-6989586621680943063"><span id="local-6989586621680943064"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addCoalesce"><span class="hs-identifier hs-type">addCoalesce</span></a></span><span>
</span><span id="line-257"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943064"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-258"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943064"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943063"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943064"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943063"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943064"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943063"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943062"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943064"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943063"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943062"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span id="addCoalesce"><span class="annot"><span class="annottext">addCoalesce :: forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; (k, cls) -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addCoalesce"><span class="hs-identifier hs-var hs-var">addCoalesce</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943058"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943058"><span class="hs-identifier hs-var">u1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680943057"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943057"><span class="hs-identifier hs-var">c1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943056"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943056"><span class="hs-identifier hs-var">u2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680943055"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943055"><span class="hs-identifier hs-var">c2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-262"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621680943050"><span class="annot"><span class="annottext">addCoalesce :: k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943050"><span class="hs-identifier hs-var hs-var">addCoalesce</span></a></span></span><span> </span><span id="local-6989586621680943049"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943049"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680943048"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943048"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680943047"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943047"><span class="hs-identifier hs-var">u'</span></a></span></span><span>
</span><span id="line-263"></span><span>         </span><span class="hs-glyph">=</span><span>      </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-264"></span><span>                        </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943046"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943046"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943046"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#addOneToUniqSet"><span class="hs-identifier hs-var">addOneToUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943046"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943047"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943049"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943048"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; UniqSet k
forall a. Uniquable a =&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unitUniqSet"><span class="hs-identifier hs-var">unitUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943047"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-266"></span><span>                        </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943049"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-267"></span><span>
</span><span id="line-268"></span><span>   </span><span class="hs-keyword">in</span><span>   </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-269"></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall {k} {cls} {color}.
Uniquable k =&gt;
k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943050"><span class="hs-identifier hs-var">addCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943058"><span class="hs-identifier hs-var">u1</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943057"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943056"><span class="hs-identifier hs-var">u2</span></a></span><span>
</span><span id="line-270"></span><span>        </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall {k} {cls} {color}.
Uniquable k =&gt;
k
-&gt; cls
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
</span><a href="#local-6989586621680943050"><span class="hs-identifier hs-var">addCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943056"><span class="hs-identifier hs-var">u2</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943055"><span class="hs-identifier hs-var">c2</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943058"><span class="hs-identifier hs-var">u1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span class="hs-comment">-- | Delete a coalescence edge (k1 -&gt; k2) from the graph.</span><span>
</span><span id="line-274"></span><span id="local-6989586621680943043"><span id="local-6989586621680943044"><span id="local-6989586621680943045"><span class="annot"><a href="GHC.Data.Graph.Ops.html#delCoalesce"><span class="hs-identifier hs-type">delCoalesce</span></a></span><span>
</span><span id="line-275"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943045"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-276"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943045"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943045"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-277"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943045"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943044"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943043"><span class="hs-identifier hs-type">color</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943045"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943044"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943043"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span id="delCoalesce"><span class="annot"><span class="annottext">delCoalesce :: forall k cls color.
Uniquable k =&gt;
k -&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delCoalesce"><span class="hs-identifier hs-var hs-var">delCoalesce</span></a></span></span><span> </span><span id="local-6989586621680943039"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943039"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621680943038"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943038"><span class="hs-identifier hs-var">k2</span></a></span></span><span>
</span><span id="line-280"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#modNode"><span class="hs-identifier hs-var">modNode</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943037"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943037"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943037"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-identifier hs-var">delOneFromUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943037"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943038"><span class="hs-identifier hs-var">k2</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-281"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943039"><span class="hs-identifier hs-var">k1</span></a></span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span class="hs-comment">-- | Add a color preference to the graph, creating nodes if required.</span><span>
</span><span id="line-285"></span><span class="hs-comment">--      The most recently added preference is the most preferred.</span><span>
</span><span id="line-286"></span><span class="hs-comment">--      The algorithm tries to assign a node it's preferred color if possible.</span><span>
</span><span id="line-287"></span><span class="hs-comment">--</span><span>
</span><span id="line-288"></span><span id="local-6989586621680943386"><span id="local-6989586621680943387"><span id="local-6989586621680943388"><span class="annot"><a href="GHC.Data.Graph.Ops.html#addPreference"><span class="hs-identifier hs-type">addPreference</span></a></span><span>
</span><span id="line-289"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943388"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-290"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943388"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943387"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943386"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-291"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943388"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943387"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943386"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943388"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943387"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943386"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span id="addPreference"><span class="annot"><span class="annottext">addPreference :: forall k cls color.
Uniquable k =&gt;
(k, cls) -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addPreference"><span class="hs-identifier hs-var hs-var">addPreference</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680943034"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943034"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680943033"><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943033"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680943032"><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943032"><span class="hs-identifier hs-var">color</span></a></span></span><span>
</span><span id="line-294"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-295"></span><span>        </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; Node k cls color
-&gt; k
-&gt; UniqFM k (Node k cls color)
-&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-296"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943031"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943031"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943031"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodePreference :: [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var">nodePreference</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943032"><span class="hs-identifier hs-var">color</span></a></span><span> </span><span class="annot"><span class="annottext">color -&gt; [color] -&gt; [color]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; [color]
forall k cls color. Node k cls color -&gt; [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var hs-var">nodePreference</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943031"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; cls -&gt; Node k cls color
forall k cls color. k -&gt; cls -&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#newNode"><span class="hs-identifier hs-var">newNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943034"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">cls
</span><a href="#local-6989586621680943033"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodePreference :: [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var">nodePreference</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680943032"><span class="hs-identifier hs-var">color</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-298"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680943034"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-comment">-- | Do aggressive coalescing on this graph.</span><span>
</span><span id="line-302"></span><span class="hs-comment">--      returns the new graph and the list of pairs of nodes that got coalesced together.</span><span>
</span><span id="line-303"></span><span class="hs-comment">--      for each pair, the resulting node will have the least key and be second in the pair.</span><span>
</span><span id="line-304"></span><span class="hs-comment">--</span><span>
</span><span id="line-305"></span><span id="local-6989586621680943376"><span id="local-6989586621680943378"><span id="local-6989586621680943379"><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceGraph"><span class="hs-identifier hs-type">coalesceGraph</span></a></span><span>
</span><span id="line-306"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943378"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                 </span><span class="hs-comment">-- ^ If True, coalesce nodes even if this might make the graph</span><span>
</span><span id="line-308"></span><span>                                </span><span class="hs-comment">--      less colorable (aggressive coalescing)</span><span>
</span><span id="line-309"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Triv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943378"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943376"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-310"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943378"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943376"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-311"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943378"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943376"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-312"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943379"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span><span>          </span><span class="hs-comment">-- pairs of nodes that were coalesced, in the order that the</span><span>
</span><span id="line-313"></span><span>                                </span><span class="hs-comment">--      coalescing was applied.</span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span id="coalesceGraph"><span class="annot"><span class="annottext">coalesceGraph :: forall k cls color.
(Uniquable k, Ord k, Eq cls, Outputable k) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; (Graph k cls color, [(k, k)])
</span><a href="GHC.Data.Graph.Ops.html#coalesceGraph"><span class="hs-identifier hs-var hs-var">coalesceGraph</span></a></span></span><span> </span><span id="local-6989586621680943021"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680943021"><span class="hs-identifier hs-var">aggressive</span></a></span></span><span> </span><span id="local-6989586621680943020"><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680943020"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621680943019"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943019"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-316"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [(k, k)])
forall k cls color.
(Uniquable k, Ord k, Eq cls, Outputable k) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [(k, k)])
</span><a href="GHC.Data.Graph.Ops.html#coalesceGraph%27"><span class="hs-identifier hs-var">coalesceGraph'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680943021"><span class="hs-identifier hs-var">aggressive</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680943020"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943019"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span id="local-6989586621680943369"><span id="local-6989586621680943370"><span id="local-6989586621680943371"><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceGraph%27"><span class="hs-identifier hs-type">coalesceGraph'</span></a></span><span>
</span><span id="line-319"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943370"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-321"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Triv</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943370"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943369"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-322"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943370"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943369"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-323"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-324"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943370"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943369"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-325"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943371"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-326"></span><span id="coalesceGraph%27"><span class="annot"><span class="annottext">coalesceGraph' :: forall k cls color.
(Uniquable k, Ord k, Eq cls, Outputable k) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [(k, k)])
</span><a href="GHC.Data.Graph.Ops.html#coalesceGraph%27"><span class="hs-identifier hs-var hs-var">coalesceGraph'</span></a></span></span><span> </span><span id="local-6989586621680943009"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680943009"><span class="hs-identifier hs-var">aggressive</span></a></span></span><span> </span><span id="local-6989586621680943008"><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680943008"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621680943007"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943007"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680943006"><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680943006"><span class="hs-identifier hs-var">kkPairsAcc</span></a></span></span><span>
</span><span id="line-327"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-328"></span><span>        </span><span class="hs-comment">-- find all the nodes that have coalescence edges</span><span>
</span><span id="line-329"></span><span>        </span><span id="local-6989586621680943005"><span class="annot"><span class="annottext">cNodes :: [Node k cls color]
</span><a href="#local-6989586621680943005"><span class="hs-identifier hs-var hs-var">cNodes</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Bool)
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680943004"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943004"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; Bool
forall a. UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#isEmptyUniqSet"><span class="hs-identifier hs-var">isEmptyUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680943004"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>                </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943007"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-331"></span><span>                </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-332"></span><span>
</span><span id="line-333"></span><span>        </span><span class="hs-comment">-- build a list of pairs of keys for node's we'll try and coalesce</span><span>
</span><span id="line-334"></span><span>        </span><span class="hs-comment">--      every pair of nodes will appear twice in this list</span><span>
</span><span id="line-335"></span><span>        </span><span class="hs-comment">--      ie [(k1, k2), (k2, k1) ... ]</span><span>
</span><span id="line-336"></span><span>        </span><span class="hs-comment">--      This is ok, GrapOps.coalesceNodes handles this and it's convenient for</span><span>
</span><span id="line-337"></span><span>        </span><span class="hs-comment">--      build a list of what nodes get coalesced together for later on.</span><span>
</span><span id="line-338"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-339"></span><span>        </span><span id="local-6989586621680943000"><span class="annot"><span class="annottext">cList :: [(k, k)]
</span><a href="#local-6989586621680943000"><span class="hs-identifier hs-var hs-var">cList</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942998"><span class="hs-identifier hs-var">node1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942997"><span class="hs-identifier hs-var">k2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-340"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680942998"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942998"><span class="hs-identifier hs-var">node1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680943005"><span class="hs-identifier hs-var">cNodes</span></a></span><span>
</span><span id="line-341"></span><span>                        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942997"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942997"><span class="hs-identifier hs-var">k2</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet k -&gt; [k]) -&gt; UniqSet k -&gt; [k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942998"><span class="hs-identifier hs-var">node1</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-342"></span><span>                        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span>        </span><span class="hs-comment">-- do the coalescing, returning the new graph and a list of pairs of keys</span><span>
</span><span id="line-345"></span><span>        </span><span class="hs-comment">--      that got coalesced together.</span><span>
</span><span id="line-346"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680942991"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942991"><span class="hs-identifier hs-var">graph'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942990"><span class="annot"><span class="annottext">[Maybe (k, k)]
</span><a href="#local-6989586621680942990"><span class="hs-identifier hs-var">mPairs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-347"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Graph k cls color -&gt; (k, k) -&gt; (Graph k cls color, Maybe (k, k)))
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [Maybe (k, k)])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; (k, k)
-&gt; (Graph k cls color, Maybe (k, k))
forall k cls color.
(Uniquable k, Ord k, Eq cls) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; (k, k)
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes"><span class="hs-identifier hs-var">coalesceNodes</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680943009"><span class="hs-identifier hs-var">aggressive</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680943008"><span class="hs-identifier hs-var">triv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680943007"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680943000"><span class="hs-identifier hs-var">cList</span></a></span><span>
</span><span id="line-348"></span><span>
</span><span id="line-349"></span><span>        </span><span class="hs-comment">-- keep running until there are no more coalesces can be found</span><span>
</span><span id="line-350"></span><span>   </span><span class="hs-keyword">in</span><span>   </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Maybe (k, k)] -&gt; [(k, k)]
forall a. [Maybe a] -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#catMaybes"><span class="hs-identifier hs-var">catMaybes</span></a></span><span> </span><span class="annot"><span class="annottext">[Maybe (k, k)]
</span><a href="#local-6989586621680942990"><span class="hs-identifier hs-var">mPairs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-351"></span><span>         </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942991"><span class="hs-identifier hs-var">graph'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, k)] -&gt; [(k, k)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680943006"><span class="hs-identifier hs-var">kkPairsAcc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-352"></span><span>         </span><span id="local-6989586621680942986"><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680942986"><span class="hs-identifier hs-var">pairs</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [(k, k)])
forall k cls color.
(Uniquable k, Ord k, Eq cls, Outputable k) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; [(k, k)]
-&gt; (Graph k cls color, [(k, k)])
</span><a href="GHC.Data.Graph.Ops.html#coalesceGraph%27"><span class="hs-identifier hs-var">coalesceGraph'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680943009"><span class="hs-identifier hs-var">aggressive</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680943008"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942991"><span class="hs-identifier hs-var">graph'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(k, k)] -&gt; [(k, k)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680942986"><span class="hs-identifier hs-var">pairs</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, k)] -&gt; [(k, k)] -&gt; [(k, k)]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, k)]
</span><a href="#local-6989586621680943006"><span class="hs-identifier hs-var">kkPairsAcc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-353"></span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span class="hs-comment">-- | Coalesce this pair of nodes unconditionally \/ aggressively.</span><span>
</span><span id="line-356"></span><span class="hs-comment">--      The resulting node is the one with the least key.</span><span>
</span><span id="line-357"></span><span class="hs-comment">--</span><span>
</span><span id="line-358"></span><span class="hs-comment">--      returns: Just    the pair of keys if the nodes were coalesced</span><span>
</span><span id="line-359"></span><span class="hs-comment">--                       the second element of the pair being the least one</span><span>
</span><span id="line-360"></span><span class="hs-comment">--</span><span>
</span><span id="line-361"></span><span class="hs-comment">--               Nothing if either of the nodes weren't in the graph</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span id="local-6989586621680943352"><span id="local-6989586621680943353"><span id="local-6989586621680943354"><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceNodes"><span class="hs-identifier hs-type">coalesceNodes</span></a></span><span>
</span><span id="line-364"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943353"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                 </span><span class="hs-comment">-- ^ If True, coalesce nodes even if this might make the graph</span><span>
</span><span id="line-366"></span><span>                                </span><span class="hs-comment">--      less colorable (aggressive coalescing)</span><span>
</span><span id="line-367"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Triv</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943353"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943352"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-368"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943353"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943352"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-369"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>               </span><span class="hs-comment">-- ^ keys of the nodes to be coalesced</span><span>
</span><span id="line-370"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943353"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943352"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943354"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span id="coalesceNodes"><span class="annot"><span class="annottext">coalesceNodes :: forall k cls color.
(Uniquable k, Ord k, Eq cls) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; (k, k)
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes"><span class="hs-identifier hs-var hs-var">coalesceNodes</span></a></span></span><span> </span><span id="local-6989586621680942972"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942972"><span class="hs-identifier hs-var">aggressive</span></a></span></span><span> </span><span id="local-6989586621680942971"><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942971"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621680942970"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942970"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680942969"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942969"><span class="hs-identifier hs-var">k1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942968"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942968"><span class="hs-identifier hs-var">k2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-373"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680942967"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942967"><span class="hs-identifier hs-var">kMin</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942966"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942966"><span class="hs-identifier hs-var">kMax</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942969"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942968"><span class="hs-identifier hs-var">k2</span></a></span><span>
</span><span id="line-374"></span><span>                                </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942969"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942968"><span class="hs-identifier hs-var">k2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-375"></span><span>                                </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942968"><span class="hs-identifier hs-var">k2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942969"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-376"></span><span>
</span><span id="line-377"></span><span>        </span><span class="hs-comment">-- the nodes being coalesced must be in the graph</span><span>
</span><span id="line-378"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942964"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942964"><span class="hs-identifier hs-var">nMin</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942970"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942967"><span class="hs-identifier hs-var">kMin</span></a></span><span>
</span><span id="line-379"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942963"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942963"><span class="hs-identifier hs-var">nMax</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942970"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942966"><span class="hs-identifier hs-var">kMax</span></a></span><span>
</span><span id="line-380"></span><span>
</span><span id="line-381"></span><span>        </span><span class="hs-comment">-- can't coalesce conflicting modes</span><span>
</span><span id="line-382"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; UniqSet k -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elementOfUniqSet"><span class="hs-identifier hs-var">elementOfUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942967"><span class="hs-identifier hs-var">kMin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942963"><span class="hs-identifier hs-var">nMax</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-383"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; UniqSet k -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elementOfUniqSet"><span class="hs-identifier hs-var">elementOfUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942966"><span class="hs-identifier hs-var">kMax</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942964"><span class="hs-identifier hs-var">nMin</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-384"></span><span>
</span><span id="line-385"></span><span>        </span><span class="hs-comment">-- can't coalesce the same node</span><span>
</span><span id="line-386"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942964"><span class="hs-identifier hs-var">nMin</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942963"><span class="hs-identifier hs-var">nMax</span></a></span><span>
</span><span id="line-387"></span><span>
</span><span id="line-388"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
forall k cls color.
(Uniquable k, Eq cls) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes_merge"><span class="hs-identifier hs-var">coalesceNodes_merge</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942972"><span class="hs-identifier hs-var">aggressive</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942971"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942970"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942967"><span class="hs-identifier hs-var">kMin</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942966"><span class="hs-identifier hs-var">kMax</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942964"><span class="hs-identifier hs-var">nMin</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942963"><span class="hs-identifier hs-var">nMax</span></a></span><span>
</span><span id="line-389"></span><span>
</span><span id="line-390"></span><span>        </span><span class="hs-comment">-- don't do the coalescing after all</span><span>
</span><span id="line-391"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-392"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942970"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (k, k)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span id="local-6989586621680943340"><span id="local-6989586621680943341"><span id="local-6989586621680943342"><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceNodes_merge"><span class="hs-identifier hs-type">coalesceNodes_merge</span></a></span><span>
</span><span id="line-395"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-397"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Triv</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943340"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-398"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943340"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-399"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-400"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943340"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-401"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943340"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-402"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943341"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943340"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943342"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span id="coalesceNodes_merge"><span class="annot"><span class="annottext">coalesceNodes_merge :: forall k cls color.
(Uniquable k, Eq cls) =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes_merge"><span class="hs-identifier hs-var hs-var">coalesceNodes_merge</span></a></span></span><span> </span><span id="local-6989586621680942951"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942951"><span class="hs-identifier hs-var">aggressive</span></a></span></span><span> </span><span id="local-6989586621680942950"><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942950"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621680942949"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942949"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680942948"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942948"><span class="hs-identifier hs-var">kMin</span></a></span></span><span> </span><span id="local-6989586621680942947"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942947"><span class="hs-identifier hs-var">kMax</span></a></span></span><span> </span><span id="local-6989586621680942946"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span></span><span> </span><span id="local-6989586621680942945"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span>        </span><span class="hs-comment">-- sanity checks</span><span>
</span><span id="line-407"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; cls
forall k cls color. Node k cls color -&gt; cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var hs-var">nodeClass</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span> </span><span class="annot"><span class="annottext">cls -&gt; cls -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; cls
forall k cls color. Node k cls color -&gt; cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var hs-var">nodeClass</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span>
</span><span id="line-408"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (Graph k cls color, Maybe (k, k))
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Data.Graph.Ops.coalesceNodes: can't coalesce nodes of different classes.&quot;</span></span><span>
</span><span id="line-409"></span><span>
</span><span id="line-410"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe color -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isNothing"><span class="hs-identifier hs-var">isNothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; Maybe color
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Maybe color -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isNothing"><span class="hs-identifier hs-var">isNothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; Maybe color
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-411"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (Graph k cls color, Maybe (k, k))
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Data.Graph.Ops.coalesceNodes: can't coalesce colored nodes.&quot;</span></span><span>
</span><span id="line-412"></span><span>
</span><span id="line-413"></span><span>        </span><span class="hs-comment">---</span><span>
</span><span id="line-414"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-415"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-416"></span><span>                </span><span class="hs-comment">-- the new node gets all the edges from its two components</span><span>
</span><span id="line-417"></span><span>                </span><span id="local-6989586621680942935"><span class="annot"><span class="annottext">node :: Node k cls color
</span><a href="#local-6989586621680942935"><span class="hs-identifier hs-var hs-var">node</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span>
</span><span id="line-418"></span><span>                 </span><span class="annot"><span class="annottext">Node :: forall k cls color.
k
-&gt; cls
-&gt; Maybe color
-&gt; UniqSet k
-&gt; UniqSet color
-&gt; [color]
-&gt; UniqSet k
-&gt; Node k cls color
</span><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span>   </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeId :: k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var">nodeId</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942948"><span class="hs-identifier hs-var">kMin</span></a></span><span>
</span><span id="line-419"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodeClass :: cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var">nodeClass</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; cls
forall k cls color. Node k cls color -&gt; cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var hs-var">nodeClass</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span>
</span><span id="line-420"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodeColor :: Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var">nodeColor</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe color
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span>                        </span><span class="hs-comment">-- nodes don't conflict with themselves..</span><span>
</span><span id="line-423"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodeConflicts :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var">nodeConflicts</span></a></span><span>
</span><span id="line-424"></span><span>                                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet k -&gt; UniqSet k -&gt; UniqSet k
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionUniqSets"><span class="hs-identifier hs-var">unionUniqSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-425"></span><span>                                        </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-operator hs-var">`delOneFromUniqSet`</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942948"><span class="hs-identifier hs-var">kMin</span></a></span><span>
</span><span id="line-426"></span><span>                                        </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-operator hs-var">`delOneFromUniqSet`</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942947"><span class="hs-identifier hs-var">kMax</span></a></span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodeExclusions :: UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var">nodeExclusions</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet color -&gt; UniqSet color -&gt; UniqSet color
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionUniqSets"><span class="hs-identifier hs-var">unionUniqSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet color
forall k cls color. Node k cls color -&gt; UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var hs-var">nodeExclusions</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet color
forall k cls color. Node k cls color -&gt; UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var hs-var">nodeExclusions</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-429"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodePreference :: [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var">nodePreference</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; [color]
forall k cls color. Node k cls color -&gt; [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var hs-var">nodePreference</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span> </span><span class="annot"><span class="annottext">[color] -&gt; [color] -&gt; [color]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; [color]
forall k cls color. Node k cls color -&gt; [color]
</span><a href="GHC.Data.Graph.Base.html#nodePreference"><span class="hs-identifier hs-var hs-var">nodePreference</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span>                        </span><span class="hs-comment">-- nodes don't coalesce with themselves..</span><span>
</span><span id="line-432"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span>
</span><span id="line-433"></span><span>                                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet k -&gt; UniqSet k -&gt; UniqSet k
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionUniqSets"><span class="hs-identifier hs-var">unionUniqSets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942946"><span class="hs-identifier hs-var">nMin</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942945"><span class="hs-identifier hs-var">nMax</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span>                                        </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-operator hs-var">`delOneFromUniqSet`</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942948"><span class="hs-identifier hs-var">kMin</span></a></span><span>
</span><span id="line-435"></span><span>                                        </span><span class="annot"><span class="annottext">UniqSet k -&gt; k -&gt; UniqSet k
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-operator hs-var">`delOneFromUniqSet`</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942947"><span class="hs-identifier hs-var">kMax</span></a></span><span>
</span><span id="line-436"></span><span>                        </span><span class="hs-special">}</span><span>
</span><span id="line-437"></span><span>
</span><span id="line-438"></span><span>          </span><span class="hs-keyword">in</span><span>    </span><span class="annot"><span class="annottext">Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
forall k cls color.
Uniquable k =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes_check"><span class="hs-identifier hs-var">coalesceNodes_check</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942951"><span class="hs-identifier hs-var">aggressive</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942950"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942949"><span class="hs-identifier hs-var">graph</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942948"><span class="hs-identifier hs-var">kMin</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942947"><span class="hs-identifier hs-var">kMax</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942935"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span id="local-6989586621680943321"><span id="local-6989586621680943322"><span id="local-6989586621680943323"><span class="annot"><a href="GHC.Data.Graph.Ops.html#coalesceNodes_check"><span class="hs-identifier hs-type">coalesceNodes_check</span></a></span><span>
</span><span id="line-441"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-442"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-443"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Triv"><span class="hs-identifier hs-type">Triv</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943322"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943321"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-444"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943322"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943321"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-445"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-446"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943322"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943321"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-447"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943322"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943321"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680943323"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span id="coalesceNodes_check"><span class="annot"><span class="annottext">coalesceNodes_check :: forall k cls color.
Uniquable k =&gt;
Bool
-&gt; Triv k cls color
-&gt; Graph k cls color
-&gt; k
-&gt; k
-&gt; Node k cls color
-&gt; (Graph k cls color, Maybe (k, k))
</span><a href="GHC.Data.Graph.Ops.html#coalesceNodes_check"><span class="hs-identifier hs-var hs-var">coalesceNodes_check</span></a></span></span><span> </span><span id="local-6989586621680942932"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942932"><span class="hs-identifier hs-var">aggressive</span></a></span></span><span> </span><span id="local-6989586621680942931"><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942931"><span class="hs-identifier hs-var">triv</span></a></span></span><span> </span><span id="local-6989586621680942930"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942930"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680942929"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942929"><span class="hs-identifier hs-var">kMin</span></a></span></span><span> </span><span id="local-6989586621680942928"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942928"><span class="hs-identifier hs-var">kMax</span></a></span></span><span> </span><span id="local-6989586621680942927"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942927"><span class="hs-identifier hs-var">node</span></a></span></span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span>        </span><span class="hs-comment">-- Unless we're coalescing aggressively, if the result node is not trivially</span><span>
</span><span id="line-452"></span><span>        </span><span class="hs-comment">--      colorable then don't do the coalescing.</span><span>
</span><span id="line-453"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942932"><span class="hs-identifier hs-var">aggressive</span></a></span><span>
</span><span id="line-454"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Triv k cls color
</span><a href="#local-6989586621680942931"><span class="hs-identifier hs-var">triv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; cls
forall k cls color. Node k cls color -&gt; cls
</span><a href="GHC.Data.Graph.Base.html#nodeClass"><span class="hs-identifier hs-var hs-var">nodeClass</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942927"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942927"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet color
forall k cls color. Node k cls color -&gt; UniqSet color
</span><a href="GHC.Data.Graph.Base.html#nodeExclusions"><span class="hs-identifier hs-var hs-var">nodeExclusions</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942927"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-455"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942930"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (k, k)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-458"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- delete the old nodes from the graph and add the new one</span><span>
</span><span id="line-459"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942925"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942925"><span class="hs-identifier hs-var">graph1</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delNode"><span class="hs-identifier hs-var">delNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942928"><span class="hs-identifier hs-var">kMax</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942930"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-460"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942923"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942923"><span class="hs-identifier hs-var">graph2</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Maybe (Graph k cls color)
</span><a href="GHC.Data.Graph.Ops.html#delNode"><span class="hs-identifier hs-var">delNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942929"><span class="hs-identifier hs-var">kMin</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942925"><span class="hs-identifier hs-var">graph1</span></a></span><span>
</span><span id="line-461"></span><span>                </span><span id="local-6989586621680942921"><span class="annot"><span class="annottext">graph3 :: Graph k cls color
</span><a href="#local-6989586621680942921"><span class="hs-identifier hs-var hs-var">graph3</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Node k cls color -&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
Uniquable k =&gt;
k -&gt; Node k cls color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#addNode"><span class="hs-identifier hs-var">addNode</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942929"><span class="hs-identifier hs-var">kMin</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942927"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942923"><span class="hs-identifier hs-var">graph2</span></a></span><span>
</span><span id="line-462"></span><span>
</span><span id="line-463"></span><span>          </span><span class="hs-keyword">in</span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942921"><span class="hs-identifier hs-var">graph3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(k, k) -&gt; Maybe (k, k)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942928"><span class="hs-identifier hs-var">kMax</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942929"><span class="hs-identifier hs-var">kMin</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-464"></span><span>
</span><span id="line-465"></span><span>
</span><span id="line-466"></span><span class="hs-comment">-- | Freeze a node</span><span>
</span><span id="line-467"></span><span class="hs-comment">--      This is for the iterative coalescer.</span><span>
</span><span id="line-468"></span><span class="hs-comment">--      By freezing a node we give up on ever coalescing it.</span><span>
</span><span id="line-469"></span><span class="hs-comment">--      Move all its coalesce edges into the frozen set - and update</span><span>
</span><span id="line-470"></span><span class="hs-comment">--      back edges from other nodes.</span><span>
</span><span id="line-471"></span><span class="hs-comment">--</span><span>
</span><span id="line-472"></span><span id="local-6989586621680943315"><span id="local-6989586621680943316"><span id="local-6989586621680943317"><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeNode"><span class="hs-identifier hs-type">freezeNode</span></a></span><span>
</span><span id="line-473"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943317"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-474"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943317"><span class="hs-identifier hs-type">k</span></a></span><span>                    </span><span class="hs-comment">-- ^ key of the node to freeze</span><span>
</span><span id="line-475"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943317"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943316"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943315"><span class="hs-identifier hs-type">color</span></a></span><span>    </span><span class="hs-comment">-- ^ the graph</span><span>
</span><span id="line-476"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943317"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943316"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943315"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>    </span><span class="hs-comment">-- ^ graph with that node frozen</span><span>
</span><span id="line-477"></span><span>
</span><span id="line-478"></span><span id="freezeNode"><span class="annot"><span class="annottext">freezeNode :: forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#freezeNode"><span class="hs-identifier hs-var hs-var">freezeNode</span></a></span></span><span> </span><span id="local-6989586621680942919"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942919"><span class="hs-identifier hs-var">k</span></a></span></span><span>
</span><span id="line-479"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-480"></span><span>  </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621680942918"><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942918"><span class="hs-identifier hs-var">fm</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-481"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- freeze all the edges in the node to be frozen</span><span>
</span><span id="line-482"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942916"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942916"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; k -&gt; Maybe (Node k cls color)
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942918"><span class="hs-identifier hs-var">fm</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942919"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-483"></span><span>        </span><span id="local-6989586621680942915"><span class="annot"><span class="annottext">node' :: Node k cls color
</span><a href="#local-6989586621680942915"><span class="hs-identifier hs-var hs-var">node'</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942916"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-484"></span><span>                </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k
forall a. UniqSet a
</span><a href="GHC.Types.Unique.Set.html#emptyUniqSet"><span class="hs-identifier hs-var">emptyUniqSet</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span>        </span><span id="local-6989586621680942912"><span class="annot"><span class="annottext">fm1 :: UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942912"><span class="hs-identifier hs-var hs-var">fm1</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
-&gt; k -&gt; Node k cls color -&gt; UniqFM k (Node k cls color)
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942918"><span class="hs-identifier hs-var">fm</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942919"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942915"><span class="hs-identifier hs-var">node'</span></a></span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span>        </span><span class="hs-comment">-- update back edges pointing to this node</span><span>
</span><span id="line-489"></span><span>        </span><span id="local-6989586621680942908"><span class="annot"><span class="annottext">freezeEdge :: a -&gt; Node a cls color -&gt; Node a cls color
</span><a href="#local-6989586621680942908"><span class="hs-identifier hs-var hs-var">freezeEdge</span></a></span></span><span> </span><span id="local-6989586621680942907"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942907"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680942906"><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942906"><span class="hs-identifier hs-var">node</span></a></span></span><span>
</span><span id="line-490"></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; UniqSet a -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#elementOfUniqSet"><span class="hs-identifier hs-var">elementOfUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942907"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node a cls color -&gt; UniqSet a
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942906"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-491"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942906"><span class="hs-identifier hs-var">node</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeCoalesce :: UniqSet a
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var">nodeCoalesce</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet a -&gt; a -&gt; UniqSet a
forall a. Uniquable a =&gt; UniqSet a -&gt; a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#delOneFromUniqSet"><span class="hs-identifier hs-var">delOneFromUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node a cls color -&gt; UniqSet a
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942906"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942907"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-492"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942906"><span class="hs-identifier hs-var">node</span></a></span><span>       </span><span class="hs-comment">-- panic &quot;GHC.Data.Graph.Ops.freezeNode: edge to freeze wasn't in the coalesce set&quot;</span><span>
</span><span id="line-493"></span><span>                                </span><span class="hs-comment">-- If the edge isn't actually in the coelesce set then just ignore it.</span><span>
</span><span id="line-494"></span><span>
</span><span id="line-495"></span><span>        </span><span id="local-6989586621680942903"><span class="annot"><span class="annottext">fm2 :: UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942903"><span class="hs-identifier hs-var hs-var">fm2</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; UniqFM k (Node k cls color)
-&gt; UniqSet k
-&gt; UniqFM k (Node k cls color)
forall elt a. (elt -&gt; a -&gt; a) -&gt; a -&gt; UniqSet elt -&gt; a
</span><a href="GHC.Types.Unique.Set.html#nonDetStrictFoldUniqSet"><span class="hs-identifier hs-var">nonDetStrictFoldUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-var">adjustUFM_C</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; Node k cls color -&gt; Node k cls color
forall {a} {cls} {color}.
Uniquable a =&gt;
a -&gt; Node a cls color -&gt; Node a cls color
</span><a href="#local-6989586621680942908"><span class="hs-identifier hs-var">freezeEdge</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942919"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942912"><span class="hs-identifier hs-var">fm1</span></a></span><span>
</span><span id="line-496"></span><span>                    </span><span class="hs-comment">-- It's OK to use a non-deterministic fold here because the</span><span>
</span><span id="line-497"></span><span>                    </span><span class="hs-comment">-- operation is commutative</span><span>
</span><span id="line-498"></span><span>                        </span><span class="annot"><span class="annottext">(UniqSet k -&gt; UniqFM k (Node k cls color))
-&gt; UniqSet k -&gt; UniqFM k (Node k cls color)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942916"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-499"></span><span>
</span><span id="line-500"></span><span>    </span><span class="hs-keyword">in</span><span>  </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color)
</span><a href="#local-6989586621680942903"><span class="hs-identifier hs-var">fm2</span></a></span><span>
</span><span id="line-501"></span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span class="hs-comment">-- | Freeze one node in the graph</span><span>
</span><span id="line-504"></span><span class="hs-comment">--      This if for the iterative coalescer.</span><span>
</span><span id="line-505"></span><span class="hs-comment">--      Look for a move related node of low degree and freeze it.</span><span>
</span><span id="line-506"></span><span class="hs-comment">--</span><span>
</span><span id="line-507"></span><span class="hs-comment">--      We probably don't need to scan the whole graph looking for the node of absolute</span><span>
</span><span id="line-508"></span><span class="hs-comment">--      lowest degree. Just sample the first few and choose the one with the lowest</span><span>
</span><span id="line-509"></span><span class="hs-comment">--      degree out of those. Also, we don't make any distinction between conflicts of different</span><span>
</span><span id="line-510"></span><span class="hs-comment">--      classes.. this is just a heuristic, after all.</span><span>
</span><span id="line-511"></span><span class="hs-comment">--</span><span>
</span><span id="line-512"></span><span class="hs-comment">--      IDEA:   freezing a node might free it up for Simplify.. would be good to check for triv</span><span>
</span><span id="line-513"></span><span class="hs-comment">--              right here, and add it to a worklist if known triv\/non-move nodes.</span><span>
</span><span id="line-514"></span><span class="hs-comment">--</span><span>
</span><span id="line-515"></span><span id="local-6989586621680943305"><span id="local-6989586621680943306"><span id="local-6989586621680943307"><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeOneInGraph"><span class="hs-identifier hs-type">freezeOneInGraph</span></a></span><span>
</span><span id="line-516"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943307"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943307"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943306"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943305"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-518"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943307"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943306"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943305"><span class="hs-identifier hs-type">color</span></a></span><span>          </span><span class="hs-comment">-- the new graph</span><span>
</span><span id="line-519"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-special">)</span></span></span></span><span>                     </span><span class="hs-comment">-- whether we found a node to freeze</span><span>
</span><span id="line-520"></span><span>
</span><span id="line-521"></span><span id="freezeOneInGraph"><span class="annot"><span class="annottext">freezeOneInGraph :: forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; (Graph k cls color, Bool)
</span><a href="GHC.Data.Graph.Ops.html#freezeOneInGraph"><span class="hs-identifier hs-var hs-var">freezeOneInGraph</span></a></span></span><span> </span><span id="local-6989586621680942900"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942900"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-522"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>  </span><span id="local-6989586621680942897"><span class="annot"><span class="annottext">compareNodeDegree :: Node a cls color -&gt; Node a cls color -&gt; Ordering
</span><a href="#local-6989586621680942897"><span class="hs-identifier hs-var hs-var">compareNodeDegree</span></a></span></span><span> </span><span id="local-6989586621680942896"><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942896"><span class="hs-identifier hs-var">n1</span></a></span></span><span> </span><span id="local-6989586621680942895"><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942895"><span class="hs-identifier hs-var">n2</span></a></span></span><span>
</span><span id="line-523"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet a -&gt; Int
forall a. UniqSet a -&gt; Int
</span><a href="GHC.Types.Unique.Set.html#sizeUniqSet"><span class="hs-identifier hs-var">sizeUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet a -&gt; Int) -&gt; UniqSet a -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color -&gt; UniqSet a
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942896"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet a -&gt; Int
forall a. UniqSet a -&gt; Int
</span><a href="GHC.Types.Unique.Set.html#sizeUniqSet"><span class="hs-identifier hs-var">sizeUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet a -&gt; Int) -&gt; UniqSet a -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color -&gt; UniqSet a
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node a cls color
</span><a href="#local-6989586621680942895"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-524"></span><span>
</span><span id="line-525"></span><span>        </span><span id="local-6989586621680942892"><span class="annot"><span class="annottext">candidates :: [Node k cls color]
</span><a href="#local-6989586621680942892"><span class="hs-identifier hs-var hs-var">candidates</span></a></span></span><span>
</span><span id="line-526"></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color -&gt; Ordering)
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. (a -&gt; a -&gt; Ordering) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/Data.OldList.html#sortBy"><span class="hs-identifier hs-var">sortBy</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Node k cls color -&gt; Ordering
forall {a} {cls} {color} {a} {cls} {color}.
Node a cls color -&gt; Node a cls color -&gt; Ordering
</span><a href="#local-6989586621680942897"><span class="hs-identifier hs-var">compareNodeDegree</span></a></span><span>
</span><span id="line-527"></span><span>                </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">5</span></span><span>        </span><span class="hs-comment">-- 5 isn't special, it's just a small number.</span><span>
</span><span id="line-528"></span><span>                </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Bool)
-&gt; Graph k cls color -&gt; [Node k cls color]
forall k cls color.
(Node k cls color -&gt; Bool)
-&gt; Graph k cls color -&gt; [Node k cls color]
</span><a href="GHC.Data.Graph.Ops.html#scanGraph"><span class="hs-identifier hs-var">scanGraph</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680942889"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942889"><span class="hs-identifier hs-var">node</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; Bool
forall a. UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#isEmptyUniqSet"><span class="hs-identifier hs-var">isEmptyUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942889"><span class="hs-identifier hs-var">node</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942900"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span>   </span><span class="hs-keyword">in</span><span>   </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942892"><span class="hs-identifier hs-var">candidates</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-531"></span><span>
</span><span id="line-532"></span><span>         </span><span class="hs-comment">-- there wasn't anything available to freeze</span><span>
</span><span id="line-533"></span><span>         </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942900"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span>
</span><span id="line-534"></span><span>
</span><span id="line-535"></span><span>         </span><span class="hs-comment">-- we found something to freeze</span><span>
</span><span id="line-536"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621680942888"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942888"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-537"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">k -&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#freezeNode"><span class="hs-identifier hs-var">freezeNode</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942888"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942900"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-538"></span><span>             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span>
</span><span id="line-540"></span><span>
</span><span id="line-541"></span><span class="hs-comment">-- | Freeze all the nodes in the graph</span><span>
</span><span id="line-542"></span><span class="hs-comment">--      for debugging the iterative allocator.</span><span>
</span><span id="line-543"></span><span class="hs-comment">--</span><span>
</span><span id="line-544"></span><span id="local-6989586621680943287"><span id="local-6989586621680943288"><span id="local-6989586621680943289"><span class="annot"><a href="GHC.Data.Graph.Ops.html#freezeAllInGraph"><span class="hs-identifier hs-type">freezeAllInGraph</span></a></span><span>
</span><span id="line-545"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943289"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-546"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943289"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943288"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943287"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-547"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943289"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943288"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943287"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span id="freezeAllInGraph"><span class="annot"><span class="annottext">freezeAllInGraph :: forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#freezeAllInGraph"><span class="hs-identifier hs-var hs-var">freezeAllInGraph</span></a></span></span><span> </span><span id="local-6989586621680942884"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942884"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-550"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; Graph k cls color -&gt; [k] -&gt; Graph k cls color
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
Uniquable k =&gt;
k -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#freezeNode"><span class="hs-identifier hs-var">freezeNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942884"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-551"></span><span>                </span><span class="annot"><span class="annottext">([k] -&gt; Graph k cls color) -&gt; [k] -&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; k) -&gt; [Node k cls color] -&gt; [k]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span>
</span><span id="line-552"></span><span>                </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [k]) -&gt; [Node k cls color] -&gt; [k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942884"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-553"></span><span>                </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-554"></span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span class="hs-comment">-- | Find all the nodes in the graph that meet some criteria</span><span>
</span><span id="line-557"></span><span class="hs-comment">--</span><span>
</span><span id="line-558"></span><span id="local-6989586621680943290"><span id="local-6989586621680943291"><span id="local-6989586621680943292"><span class="annot"><a href="GHC.Data.Graph.Ops.html#scanGraph"><span class="hs-identifier hs-type">scanGraph</span></a></span><span>
</span><span id="line-559"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943292"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943291"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943290"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span>
</span><span id="line-560"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943292"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943291"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943290"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-561"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943292"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943291"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943290"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span id="scanGraph"><span class="annot"><span class="annottext">scanGraph :: forall k cls color.
(Node k cls color -&gt; Bool)
-&gt; Graph k cls color -&gt; [Node k cls color]
</span><a href="GHC.Data.Graph.Ops.html#scanGraph"><span class="hs-identifier hs-var hs-var">scanGraph</span></a></span></span><span> </span><span id="local-6989586621680942883"><span class="annot"><span class="annottext">Node k cls color -&gt; Bool
</span><a href="#local-6989586621680942883"><span class="hs-identifier hs-var">match</span></a></span></span><span> </span><span id="local-6989586621680942882"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942882"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-564"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Bool)
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Bool
</span><a href="#local-6989586621680942883"><span class="hs-identifier hs-var">match</span></a></span><span> </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942882"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-565"></span><span>          </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span>
</span><span id="line-568"></span><span class="hs-comment">-- | validate the internal structure of a graph</span><span>
</span><span id="line-569"></span><span class="hs-comment">--      all its edges should point to valid nodes</span><span>
</span><span id="line-570"></span><span class="hs-comment">--      If they don't then throw an error</span><span>
</span><span id="line-571"></span><span class="hs-comment">--</span><span>
</span><span id="line-572"></span><span id="local-6989586621680943275"><span id="local-6989586621680943277"><span id="local-6989586621680943278"><span class="annot"><a href="GHC.Data.Graph.Ops.html#validateGraph"><span class="hs-identifier hs-type">validateGraph</span></a></span><span>
</span><span id="line-573"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943278"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943278"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943277"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>                         </span><span class="hs-comment">-- ^ extra debugging info to display on error</span><span>
</span><span id="line-575"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                         </span><span class="hs-comment">-- ^ whether this graph is supposed to be colored.</span><span>
</span><span id="line-576"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943278"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943275"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943277"><span class="hs-identifier hs-type">color</span></a></span><span>            </span><span class="hs-comment">-- ^ graph to validate</span><span>
</span><span id="line-577"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943278"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943275"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943277"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>            </span><span class="hs-comment">-- ^ validated graph</span><span>
</span><span id="line-578"></span><span>
</span><span id="line-579"></span><span id="validateGraph"><span class="annot"><span class="annottext">validateGraph :: forall k color cls.
(Uniquable k, Outputable k, Eq color) =&gt;
SDoc -&gt; Bool -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#validateGraph"><span class="hs-identifier hs-var hs-var">validateGraph</span></a></span></span><span> </span><span id="local-6989586621680942864"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680942864"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span id="local-6989586621680942863"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942863"><span class="hs-identifier hs-var">isColored</span></a></span></span><span> </span><span id="local-6989586621680942862"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-580"></span><span>
</span><span id="line-581"></span><span>        </span><span class="hs-comment">-- Check that all edges point to valid nodes.</span><span>
</span><span id="line-582"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680942861"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942861"><span class="hs-identifier hs-var">edges</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[UniqSet k] -&gt; UniqSet k
forall a. [UniqSet a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#unionManyUniqSets"><span class="hs-identifier hs-var">unionManyUniqSets</span></a></span><span>
</span><span id="line-583"></span><span>                                </span><span class="hs-special">(</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; UniqSet k)
-&gt; [Node k cls color] -&gt; [UniqSet k]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span>       </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [UniqSet k])
-&gt; [Node k cls color] -&gt; [UniqSet k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-584"></span><span>                                </span><span class="annot"><span class="annottext">[UniqSet k] -&gt; [UniqSet k] -&gt; [UniqSet k]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; UniqSet k)
-&gt; [Node k cls color] -&gt; [UniqSet k]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeCoalesce"><span class="hs-identifier hs-var hs-var">nodeCoalesce</span></a></span><span>        </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [UniqSet k])
-&gt; [Node k cls color] -&gt; [UniqSet k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942859"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942859"><span class="hs-identifier hs-var">nodes</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[k] -&gt; UniqSet k
forall a. Uniquable a =&gt; [a] -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#mkUniqSet"><span class="hs-identifier hs-var">mkUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">([k] -&gt; UniqSet k) -&gt; [k] -&gt; UniqSet k
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; k) -&gt; [Node k cls color] -&gt; [k]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span> </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [k]) -&gt; [Node k cls color] -&gt; [k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-587"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942857"><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942857"><span class="hs-identifier hs-var">badEdges</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; UniqSet k -&gt; UniqSet k
forall a. UniqSet a -&gt; UniqSet a -&gt; UniqSet a
</span><a href="GHC.Types.Unique.Set.html#minusUniqSet"><span class="hs-identifier hs-var">minusUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942861"><span class="hs-identifier hs-var">edges</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942859"><span class="hs-identifier hs-var">nodes</span></a></span><span>
</span><span id="line-588"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; Bool
forall a. UniqSet a -&gt; Bool
</span><a href="GHC.Types.Unique.Set.html#isEmptyUniqSet"><span class="hs-identifier hs-var">isEmptyUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942857"><span class="hs-identifier hs-var">badEdges</span></a></span><span>
</span><span id="line-589"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Graph k cls color
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Data.Graph.Ops.validateGraph&quot;</span></span><span>
</span><span id="line-590"></span><span>                </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Graph has edges that point to non-existent nodes&quot;</span></span><span>
</span><span id="line-591"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  bad edges: &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k k -&gt; ([k] -&gt; SDoc) -&gt; SDoc
forall key a. UniqFM key a -&gt; ([a] -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.Types.Unique.FM.html#pprUFM"><span class="hs-identifier hs-var">pprUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqSet k -&gt; UniqFM k k
forall a. UniqSet a -&gt; UniqFM a a
</span><a href="GHC.Types.Unique.Set.html#getUniqSet"><span class="hs-identifier hs-var">getUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet k
</span><a href="#local-6989586621680942857"><span class="hs-identifier hs-var">badEdges</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc) -&gt; ([k] -&gt; [SDoc]) -&gt; [k] -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; SDoc) -&gt; [k] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680942864"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-593"></span><span>
</span><span id="line-594"></span><span>        </span><span class="hs-comment">-- Check that no conflicting nodes have the same color</span><span>
</span><span id="line-595"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680942847"><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942847"><span class="hs-identifier hs-var">badNodes</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Bool)
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool)
-&gt; (Node k cls color -&gt; Bool) -&gt; Node k cls color -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; Node k cls color -&gt; Bool
forall k color cls.
(Uniquable k, Eq color) =&gt;
Graph k cls color -&gt; Node k cls color -&gt; Bool
</span><a href="GHC.Data.Graph.Ops.html#checkNode"><span class="hs-identifier hs-var">checkNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-596"></span><span>                        </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-597"></span><span>                           </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-598"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Node k cls color] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942847"><span class="hs-identifier hs-var">badNodes</span></a></span><span>
</span><span id="line-599"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Graph k cls color
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Data.Graph.Ops.validateGraph&quot;</span></span><span>
</span><span id="line-600"></span><span>                </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Node has same color as one of it's conflicts&quot;</span></span><span>
</span><span id="line-601"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  bad nodes: &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; SDoc) -&gt; [Node k cls color] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; SDoc) -&gt; (Node k cls color -&gt; k) -&gt; Node k cls color -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942847"><span class="hs-identifier hs-var">badNodes</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-602"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680942864"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-603"></span><span>
</span><span id="line-604"></span><span>        </span><span class="hs-comment">-- If this is supposed to be a colored graph,</span><span>
</span><span id="line-605"></span><span>        </span><span class="hs-comment">--      check that all nodes have a color.</span><span>
</span><span id="line-606"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680942863"><span class="hs-identifier hs-var">isColored</span></a></span><span>
</span><span id="line-607"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942843"><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942843"><span class="hs-identifier hs-var">badNodes</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Bool)
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680942842"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942842"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe color -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isNothing"><span class="hs-identifier hs-var">isNothing</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe color -&gt; Bool) -&gt; Maybe color -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Maybe color
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942842"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-608"></span><span>                        </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [Node k cls color])
-&gt; [Node k cls color] -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-609"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; Bool -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Node k cls color] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942843"><span class="hs-identifier hs-var">badNodes</span></a></span><span>
</span><span id="line-610"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Graph k cls color
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;GHC.Data.Graph.Ops.validateGraph&quot;</span></span><span>
</span><span id="line-611"></span><span>                </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Supposably colored graph has uncolored nodes.&quot;</span></span><span>
</span><span id="line-612"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  uncolored nodes: &quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Node k cls color -&gt; SDoc) -&gt; [Node k cls color] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; SDoc) -&gt; (Node k cls color -&gt; k) -&gt; Node k cls color -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; k
forall k cls color. Node k cls color -&gt; k
</span><a href="GHC.Data.Graph.Base.html#nodeId"><span class="hs-identifier hs-var hs-var">nodeId</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942843"><span class="hs-identifier hs-var">badNodes</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-613"></span><span>                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621680942864"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span>        </span><span class="hs-comment">-- graph looks ok</span><span>
</span><span id="line-617"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-618"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942862"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-619"></span><span>
</span><span id="line-620"></span><span>
</span><span id="line-621"></span><span class="hs-comment">-- | If this node is colored, check that all the nodes which</span><span>
</span><span id="line-622"></span><span class="hs-comment">--      conflict with it have different colors.</span><span>
</span><span id="line-623"></span><span id="local-6989586621680943262"><span id="local-6989586621680943263"><span id="local-6989586621680943264"><span class="annot"><a href="GHC.Data.Graph.Ops.html#checkNode"><span class="hs-identifier hs-type">checkNode</span></a></span><span>
</span><span id="line-624"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943264"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680943263"><span class="hs-identifier hs-type">color</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-625"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943264"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943262"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943263"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-626"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621680943264"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943262"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943263"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-627"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span></span><span>                 </span><span class="hs-comment">-- ^ True if this node is ok</span><span>
</span><span id="line-628"></span><span>
</span><span id="line-629"></span><span id="checkNode"><span class="annot"><span class="annottext">checkNode :: forall k color cls.
(Uniquable k, Eq color) =&gt;
Graph k cls color -&gt; Node k cls color -&gt; Bool
</span><a href="GHC.Data.Graph.Ops.html#checkNode"><span class="hs-identifier hs-var hs-var">checkNode</span></a></span></span><span> </span><span id="local-6989586621680942833"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942833"><span class="hs-identifier hs-var">graph</span></a></span></span><span> </span><span id="local-6989586621680942832"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942832"><span class="hs-identifier hs-var">node</span></a></span></span><span>
</span><span id="line-630"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942831"><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680942831"><span class="hs-identifier hs-var">color</span></a></span></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Maybe color
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942832"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-631"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942830"><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942830"><span class="hs-identifier hs-var">neighbors</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Maybe (Node k cls color)] -&gt; Maybe [Node k cls color]
forall (t :: * -&gt; *) (m :: * -&gt; *) a.
(Traversable t, Monad m) =&gt;
t (m a) -&gt; m (t a)
</span><a href="../../base/src/Data.Traversable.html#sequence"><span class="hs-identifier hs-var">sequence</span></a></span><span> </span><span class="annot"><span class="annottext">([Maybe (Node k cls color)] -&gt; Maybe [Node k cls color])
-&gt; [Maybe (Node k cls color)] -&gt; Maybe [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; Maybe (Node k cls color))
-&gt; [k] -&gt; [Maybe (Node k cls color)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
forall k cls color.
Uniquable k =&gt;
Graph k cls color -&gt; k -&gt; Maybe (Node k cls color)
</span><a href="GHC.Data.Graph.Ops.html#lookupNode"><span class="hs-identifier hs-var">lookupNode</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942833"><span class="hs-identifier hs-var">graph</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-632"></span><span>                                </span><span class="annot"><span class="annottext">([k] -&gt; [Maybe (Node k cls color)])
-&gt; [k] -&gt; [Maybe (Node k cls color)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="annot"><span class="annottext">UniqSet k -&gt; [k]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet k -&gt; [k]) -&gt; UniqSet k -&gt; [k]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942832"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-633"></span><span>            </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942828"><span class="annot"><span class="annottext">[color]
</span><a href="#local-6989586621680942828"><span class="hs-identifier hs-var">neighbourColors</span></a></span></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Maybe color] -&gt; [color]
forall a. [Maybe a] -&gt; [a]
</span><a href="../../base/src/Data.Maybe.html#catMaybes"><span class="hs-identifier hs-var">catMaybes</span></a></span><span> </span><span class="annot"><span class="annottext">([Maybe color] -&gt; [color]) -&gt; [Maybe color] -&gt; [color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Maybe color)
-&gt; [Node k cls color] -&gt; [Maybe color]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; Maybe color
forall k cls color. Node k cls color -&gt; Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var hs-var">nodeColor</span></a></span><span> </span><span class="annot"><span class="annottext">[Node k cls color]
</span><a href="#local-6989586621680942830"><span class="hs-identifier hs-var">neighbors</span></a></span><span>
</span><span id="line-636"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">color -&gt; [color] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-identifier hs-var">elem</span></a></span><span> </span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680942831"><span class="hs-identifier hs-var">color</span></a></span><span> </span><span class="annot"><span class="annottext">[color]
</span><a href="#local-6989586621680942828"><span class="hs-identifier hs-var">neighbourColors</span></a></span><span>
</span><span id="line-637"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-638"></span><span>
</span><span id="line-639"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-640"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-641"></span><span>
</span><span id="line-642"></span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span class="hs-comment">-- | Slurp out a map of how many nodes had a certain number of conflict neighbours</span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span id="local-6989586621680943251"><span id="local-6989586621680943252"><span id="local-6989586621680943253"><span class="annot"><a href="GHC.Data.Graph.Ops.html#slurpNodeConflictCount"><span class="hs-identifier hs-type">slurpNodeConflictCount</span></a></span><span>
</span><span id="line-647"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943253"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943252"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943251"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-648"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span></span></span></span><span>    </span><span class="hs-comment">-- ^ (conflict neighbours, num nodes with that many conflicts)</span><span>
</span><span id="line-649"></span><span>
</span><span id="line-650"></span><span id="slurpNodeConflictCount"><span class="annot"><span class="annottext">slurpNodeConflictCount :: forall k cls color. Graph k cls color -&gt; UniqFM Int (Int, Int)
</span><a href="GHC.Data.Graph.Ops.html#slurpNodeConflictCount"><span class="hs-identifier hs-var hs-var">slurpNodeConflictCount</span></a></span></span><span> </span><span id="local-6989586621680942821"><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942821"><span class="hs-identifier hs-var">graph</span></a></span></span><span>
</span><span id="line-651"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Int, Int) -&gt; (Int, Int) -&gt; (Int, Int))
-&gt; UniqFM Int (Int, Int)
-&gt; [(Int, (Int, Int))]
-&gt; UniqFM Int (Int, Int)
forall key elt.
Uniquable key =&gt;
(elt -&gt; elt -&gt; elt)
-&gt; UniqFM key elt -&gt; [(key, elt)] -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addListToUFM_C"><span class="hs-identifier hs-var">addListToUFM_C</span></a></span><span>
</span><span id="line-652"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621680942819"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942819"><span class="hs-identifier hs-var">c1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942818"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942818"><span class="hs-identifier hs-var">n1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680942817"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942817"><span class="hs-identifier hs-var">n2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942819"><span class="hs-identifier hs-var">c1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942818"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942817"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-653"></span><span>                </span><span class="annot"><span class="annottext">UniqFM Int (Int, Int)
forall key elt. UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#emptyUFM"><span class="hs-identifier hs-var">emptyUFM</span></a></span><span>
</span><span id="line-654"></span><span>        </span><span class="annot"><span class="annottext">([(Int, (Int, Int))] -&gt; UniqFM Int (Int, Int))
-&gt; [(Int, (Int, Int))] -&gt; UniqFM Int (Int, Int)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; (Int, (Int, Int)))
-&gt; [Node k cls color] -&gt; [(Int, (Int, Int))]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span>   </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680942814"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942814"><span class="hs-identifier hs-var">node</span></a></span></span><span>
</span><span id="line-655"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680942813"><span class="annot"><span class="annottext">count :: Int
</span><a href="#local-6989586621680942813"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet k -&gt; Int
forall a. UniqSet a -&gt; Int
</span><a href="GHC.Types.Unique.Set.html#sizeUniqSet"><span class="hs-identifier hs-var">sizeUniqSet</span></a></span><span> </span><span class="annot"><span class="annottext">(UniqSet k -&gt; Int) -&gt; UniqSet k -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color -&gt; UniqSet k
forall k cls color. Node k cls color -&gt; UniqSet k
</span><a href="GHC.Data.Graph.Base.html#nodeConflicts"><span class="hs-identifier hs-var hs-var">nodeConflicts</span></a></span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942814"><span class="hs-identifier hs-var">node</span></a></span><span>
</span><span id="line-656"></span><span>                     </span><span class="hs-keyword">in</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942813"><span class="hs-identifier hs-var">count</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680942813"><span class="hs-identifier hs-var">count</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-657"></span><span>        </span><span class="annot"><span class="annottext">([Node k cls color] -&gt; [(Int, (Int, Int))])
-&gt; [Node k cls color] -&gt; [(Int, (Int, Int))]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#nonDetEltsUFM"><span class="hs-identifier hs-var">nonDetEltsUFM</span></a></span><span>
</span><span id="line-658"></span><span>        </span><span class="hs-comment">-- See Note [Unique Determinism and code generation]</span><span>
</span><span id="line-659"></span><span>        </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; [Node k cls color])
-&gt; UniqFM k (Node k cls color) -&gt; [Node k cls color]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color -&gt; UniqFM k (Node k cls color)
forall k cls color.
Graph k cls color -&gt; UniqFM k (Node k cls color)
</span><a href="GHC.Data.Graph.Base.html#graphMap"><span class="hs-identifier hs-var hs-var">graphMap</span></a></span><span> </span><span class="annot"><span class="annottext">Graph k cls color
</span><a href="#local-6989586621680942821"><span class="hs-identifier hs-var">graph</span></a></span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span class="hs-comment">-- | Set the color of a certain node</span><span>
</span><span id="line-663"></span><span id="local-6989586621680943240"><span id="local-6989586621680943241"><span id="local-6989586621680943242"><span class="annot"><a href="GHC.Data.Graph.Ops.html#setColor"><span class="hs-identifier hs-type">setColor</span></a></span><span>
</span><span id="line-664"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943242"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-665"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943242"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943241"><span class="hs-identifier hs-type">color</span></a></span><span>
</span><span id="line-666"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943242"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943240"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943241"><span class="hs-identifier hs-type">color</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Base.html#Graph"><span class="hs-identifier hs-type">Graph</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943242"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943240"><span class="hs-identifier hs-type">cls</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943241"><span class="hs-identifier hs-type">color</span></a></span></span></span></span><span>
</span><span id="line-667"></span><span>
</span><span id="line-668"></span><span id="setColor"><span class="annot"><span class="annottext">setColor :: forall k color cls.
Uniquable k =&gt;
k -&gt; color -&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Ops.html#setColor"><span class="hs-identifier hs-var hs-var">setColor</span></a></span></span><span> </span><span id="local-6989586621680942810"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942810"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680942809"><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680942809"><span class="hs-identifier hs-var">color</span></a></span></span><span>
</span><span id="line-669"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
forall k cls color.
(UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color -&gt; Graph k cls color
</span><a href="GHC.Data.Graph.Base.html#graphMapModify"><span class="hs-identifier hs-var">graphMapModify</span></a></span><span>
</span><span id="line-670"></span><span>        </span><span class="annot"><span class="annottext">((UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
 -&gt; Graph k cls color -&gt; Graph k cls color)
-&gt; (UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color))
-&gt; Graph k cls color
-&gt; Graph k cls color
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Node k cls color -&gt; Node k cls color)
-&gt; k -&gt; UniqFM k (Node k cls color) -&gt; UniqFM k (Node k cls color)
forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-var">adjustUFM_C</span></a></span><span>
</span><span id="line-671"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680942808"><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942808"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Node k cls color
</span><a href="#local-6989586621680942808"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">nodeColor :: Maybe color
</span><a href="GHC.Data.Graph.Base.html#nodeColor"><span class="hs-identifier hs-var">nodeColor</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">color -&gt; Maybe color
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">color
</span><a href="#local-6989586621680942809"><span class="hs-identifier hs-var">color</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-672"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942810"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-673"></span><span>
</span><span id="line-674"></span><span>
</span><span id="line-675"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-pragma hs-type">adjustWithDefaultUFM</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-676"></span><span id="local-6989586621680943440"><span id="local-6989586621680943441"><span class="annot"><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-type">adjustWithDefaultUFM</span></a></span><span>
</span><span id="line-677"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943441"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-678"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943440"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943440"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943440"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943441"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-679"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943441"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943440"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943441"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943440"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-680"></span><span>
</span><span id="line-681"></span><span id="adjustWithDefaultUFM"><span class="annot"><span class="annottext">adjustWithDefaultUFM :: forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; a -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustWithDefaultUFM"><span class="hs-identifier hs-var hs-var">adjustWithDefaultUFM</span></a></span></span><span> </span><span id="local-6989586621680942805"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680942805"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680942804"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942804"><span class="hs-identifier hs-var">def</span></a></span></span><span> </span><span id="local-6989586621680942803"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942803"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680942802"><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942802"><span class="hs-identifier hs-var">map</span></a></span></span><span>
</span><span id="line-682"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; UniqFM k a -&gt; k -&gt; a -&gt; UniqFM k a
forall key elt.
Uniquable key =&gt;
(elt -&gt; elt -&gt; elt)
-&gt; UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_C"><span class="hs-identifier hs-var">addToUFM_C</span></a></span><span>
</span><span id="line-683"></span><span>                </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680942800"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942800"><span class="hs-identifier hs-var">old</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680942805"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942800"><span class="hs-identifier hs-var">old</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-684"></span><span>                </span><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942802"><span class="hs-identifier hs-var">map</span></a></span><span>
</span><span id="line-685"></span><span>                </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942803"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942804"><span class="hs-identifier hs-var">def</span></a></span><span>
</span><span id="line-686"></span><span>
</span><span id="line-687"></span><span class="hs-comment">-- Argument order different from UniqFM's adjustUFM</span><span>
</span><span id="line-688"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-pragma hs-type">adjustUFM_C</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-689"></span><span id="local-6989586621680943503"><span id="local-6989586621680943504"><span class="annot"><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-type">adjustUFM_C</span></a></span><span>
</span><span id="line-690"></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Uniquable"><span class="hs-identifier hs-type">Uniquable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943504"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-691"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680943503"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943503"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-692"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680943504"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943504"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943503"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943504"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680943503"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span id="adjustUFM_C"><span class="annot"><span class="annottext">adjustUFM_C :: forall k a.
Uniquable k =&gt;
(a -&gt; a) -&gt; k -&gt; UniqFM k a -&gt; UniqFM k a
</span><a href="GHC.Data.Graph.Ops.html#adjustUFM_C"><span class="hs-identifier hs-var hs-var">adjustUFM_C</span></a></span></span><span> </span><span id="local-6989586621680942796"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680942796"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680942795"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942795"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680942794"><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942794"><span class="hs-identifier hs-var">map</span></a></span></span><span>
</span><span id="line-695"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UniqFM k a -&gt; k -&gt; Maybe a
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942794"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942795"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-696"></span><span>        </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942794"><span class="hs-identifier hs-var">map</span></a></span><span>
</span><span id="line-697"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680942793"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942793"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UniqFM k a -&gt; k -&gt; a -&gt; UniqFM k a
forall key elt.
Uniquable key =&gt;
UniqFM key elt -&gt; key -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM"><span class="hs-identifier hs-var">addToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM k a
</span><a href="#local-6989586621680942794"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621680942795"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621680942796"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680942793"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-698"></span><span>
</span><span id="line-699"></span></pre></body></html>